<{include file="Business/business_top.html" }>
<style>
	#tip{font-size: 15px;
		text-align: center;
		display: block;
		margin-top: 10px;
		margin-bottom: -13px;
		color: gray;}

	/**上传图片**/
	#up{
		position: relative;
		left: -74px;
		top: -62px;
		width: 1rem;
		height: 1rem;
		opacity: 0;

	}
	iframe{position: fixed;z-index: 10002;top: 0;background-color: white;display: none;border:none;}
</style>
    </head>
    <body>
	<{include file="Business/business_nav.html" }>
    	<div id="wrap">
			<form id="form">
    		<div class="consult">
				<input type="hidden" name="id" value="<{$id}>" />
				<input type="hidden" name="type" id="type" value="<{$smarty.const.OBJ_TYPE_STORE}>"/>
    			<div class="title" style="display: none">选择类型:</div>
    			<div class="radio-group" style="display: none;">
    				<a href="javascript:void(0);" data-type="1" class="on"><i></i>咨询</a>
    				<a href="javascript:void(0);" data-type="2"><i></i>评价</a>
    			</div>
    			<div class="title">内容描述</div>
    			<div class="textarea-box">
    				<textarea id="desc" name="content" required="required"></textarea>
    			</div>




    			<div class="upload-box" style="display: none">
					<div class="upload"  id="album"></div>
					<!--<input type="file" name="file"  id="up"  >-->
    			</div>
    		</div>

    		<input type="submit" class="submit" id="submit" value="提  交"></input>
			</form>
    	</div>
		<iframe id="resizeImage" src="<{u('Common/resizeImage?type=IMG_COMMENT')}>" ></iframe>
		<script src="<{$preStaticUrl}>js/jquery-1.11.0.js?v=<{$resVersion}>"></script>
		<script src="<{$preStaticUrl}>js/jquery.ajaxfileupload.js"></script>
    	<script>
    		$(function(){

				$('#form').on('submit',function(){
					var data=$('#form').serialize();
					$.post("<{u('comment')}>",data,function(res){
						if(res.status==0){
							tip("评论成功",function(){location.href="<{u('detail?id='|cat:$id)}>"});
						}
						tip(res.msg);

					},"json");
					return false;

				});

				
				//删除图片
				$(document).on("click",".delete",function(){
					$(this).parent().remove();
				});

				$('#cutImage,#resizeImage').css({'height':document.body.clientHeight+"px",'width':document.body.clientWidth+"px"})

    		})

			function newImg(src){
				var img = '<div class="item" style="background:url('+src+') no-repeat;">'+
									'<a href="javascript:void(0);" class="delete"></a>'+
									'<input type="hidden" name="album[]" value="'+src+'" class="file"/>'+
								'</div>';
					$(".upload-box").prepend(img)
			}

			$('#album').on('click',function(){
				$('#resizeImage').show();
				$(document.getElementById('resizeImage').contentWindow.document.getElementById('file')).click()
			});
			function closeIframeResize(){
				$('#resizeImage').hide();
			}

    	</script>
	</body>
</html>
